//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	ISecurityFactory.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System.Collections.Generic;

namespace Smart.Common.Security
{
	/// <summary>
	/// Security factory
	/// </summary>
	public interface ISecurityFactory
	{
		/// <summary>
		/// Get service by serviceName
		/// </summary>
		ISecurityService GetService(string serviceName);

		/// <summary>
		/// Create new securable filter
		/// </summary>
		SecurableFilter CreateFilter(string serviceName);

		/// <summary>
		/// Get securable object types
		/// </summary>
		ICollection<SecurableType> GetSecurableTypes(string serviceName);

		/// <summary>
		/// Ensure all securable security assignments
		/// </summary>
		/// <returns>true, if security changed</returns>
		bool EnsureSecurity(string serviceName, IDictionary<string, object> values);

		/// <summary>
		/// Ensure filtered securable objects of specified type security assignments
		/// </summary>
		/// <returns>true, if security changed</returns>
		bool EnsureSecurity(string serviceName, SecurableType securableType, IDictionary<string, object> values);

		/// <summary>
		/// Ensure filtered securable objects of specified type security assignments
		/// </summary>
		/// <returns>true, if security changed</returns>
		bool EnsureSecurity(string serviceName, SecurableType securableType, SecurableFilter filter, IDictionary<string, object> values);

		/// <summary>
		/// Ensure specified securable security assignments
		/// </summary>
		/// <returns>true, if security changed</returns>
		bool EnsureSecurity(string serviceName, string instanceId, IDictionary<string, object> values);

		/// <summary>
		/// <para>Ensure specified securable security assignments.</para>
		/// <para>Warning! Should be called from security context and securable should be from security context (aka RunElevated for SharePoint)!</para>
		///  </summary>
		/// <returns>true, if security changed</returns>
		bool EnsureSecurity(string serviceName, SecurableType securableType, ISecurable securable, IDictionary<string, object> values);

		/// <summary>
		/// <para>Ensure specified securable security assignments.</para>
		/// <para>Warning! Should be called from security context and securable should be from security context (aka RunElevated for SharePoint)!</para>
		/// </summary>
		/// <returns>true, if security changed</returns>
		bool EnsureSecurity(string serviceName, SecuritySecurableAssignments securableAssignments, IDictionary<string, object> values);
	}
}